-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement mem::{zeroed,uninitialized} in terms of MaybeUninit. #62150
Conversation
r? @Kimundi (rust_highfive has picked a reviewer for you, use r? to override) |
r? @oli-obk |
looks fine to me from a compiler perspective maybe someone from @rust-lang/libs wants to look at the cc @RalfJung |
Fine from a Let's ask perf though, just to be sure. @bors try |
Note that the |
Maybe it makes sense to mark the |
good idea |
Why remove the calls to |
@SimonSapin They happen in |
Hmm, simply sticking a |
r? @RalfJung Feel free to review this since the PR doesn't change anything observably. |
@alex Yes, items without a |
5c150fc
to
b3b2d48
Compare
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Oof. Is the correct fix just to |
I think we should do the steps @oli-obk outlined in #62061 (comment). If we do that, then imo we can just remove |
That seems like a change with enough potential for problems that I wouldn't want to block removing
Yes. |
I think the idea was not to block this PR, but to just nix |
Well that would be fine for me. It would commit ourselves to not follow this plan and instead do the "proper" thing right away. I just wanted to not stand in the way of making But I will never argue against nixing an intrinsic such as |
b3b2d48
to
b366f2b
Compare
Ok, should be green now. I don't know nearly enough about the |
Seems like this PR caused SIGILL in a bunch of libraries (see the backlinks GH inserted above), but it also seems like these libraries all had UB -- so tiny changes in the implementations of these methods can lead to arbitrary changes in behavior. |
Based on what described in amethyst/amethyst#1808 (comment), I suggest that this change to be backed out for at least one stable release. This kind of UB existed in old dependencies that are no longer maintained, therefore some crates have to migrate their dependency to the latest version to mitigate the issue, and we need some time for the ecosystem to do that major version upgrades. |
@ishitatsuyuki a closed PR is not a good place for a new discussion. Could you open a new issue and Cc me? Then I will nominate it for lang team discussion. |
implement zeroed and uninitialized with MaybeUninit This is the second attempt of doing such a change (first PR: rust-lang#62150). The last change [got reverted](rust-lang#63343) because it [caused](rust-lang#62825) some [issues](rust-lang#52898 (comment)) in [code that incorrectly used these functions](AltF02/x11-rs#99). Since then, the [problematic code has been fixed](AltF02/x11-rs#101), and rustc [gained a lint](rust-lang#63346) that is able to detect many misuses of these functions statically and a [dynamic check that panics](rust-lang#66059) instead of causing UB for some incorrect uses. Fixes rust-lang#62825
implement zeroed and uninitialized with MaybeUninit This is the second attempt of doing such a change (first PR: rust-lang#62150). The last change [got reverted](rust-lang#63343) because it [caused](rust-lang#62825) some [issues](rust-lang#52898 (comment)) in [code that incorrectly used these functions](AltF02/x11-rs#99). Since then, the [problematic code has been fixed](AltF02/x11-rs#101), and rustc [gained a lint](rust-lang#63346) that is able to detect many misuses of these functions statically and a [dynamic check that panics](rust-lang#66059) instead of causing UB for some incorrect uses. Fixes rust-lang#62825
implement zeroed and uninitialized with MaybeUninit This is the second attempt of doing such a change (first PR: rust-lang#62150). The last change [got reverted](rust-lang#63343) because it [caused](rust-lang#62825) some [issues](rust-lang#52898 (comment)) in [code that incorrectly used these functions](AltF02/x11-rs#99). Since then, the [problematic code has been fixed](AltF02/x11-rs#101), and rustc [gained a lint](rust-lang#63346) that is able to detect many misuses of these functions statically and a [dynamic check that panics](rust-lang#66059) instead of causing UB for some incorrect uses. Fixes rust-lang#62825
Refs #62061
r? @oli-obk